<?php

namespace yan\editor_frontend\editor;

use yii\helpers\Html;

class WebTabsWidget extends \yii\base\Widget
{
    public $value;
    public $child;
    public $that;
    public $parent_type;

    public function run()
    {
        $shtml = '';
        $tab_header = '';
        $tab_content = '';
        foreach ((array)$this->value['value']['content']['title'] as $key => $val) {
			$option = isset($this->value['value']['content']['options'][$key]) ? $this->value['value']['content']['options'][$key] : '';
            $active = $key == 0 ? 'active' : '';
            $style = $key == 0 ? 'display: block;' : '';
            $tab_header .= '<a class="ts03 '.$active.'" href="javascript:;">'.$val.'</a>';
            $tab_content .= '<div class="common_change_c"  style="'.$style.'">'.\common\utils\Helper::showContent($option).'</div>';
        }
        $shtml = Html::tag('div', $tab_header, ['class'=>'common_tt clear comm_tabm']);
        $shtml .= Html::tag('div', '', ['class'=>'common_line']);
        $shtml .= Html::tag('div', $tab_content, ['class'=>'common_tc comm_tabc']);
        return Html::tag('div', $shtml, ['class'=>'prize_box']);
    }
}
